#version 450

layout (location = 0) in vec3 InPos;

// layout (push_constant) uniform SPointVertexPushConstants
// {
//   mat4 PVM; // light projection matrix *light view matrix * *model's matrix 

// } PushConstants;

layout (set=0, binding = 0) uniform PointLightBufferObject
{
  mat4 ProjectView; //光源的投影矩阵和视图矩阵
  vec3 LightPos; //光源的位置
} PointLight;


layout (set=1, binding = 0) uniform ModelBufferObject
{
  mat4 Model;
} Model;

//传出顶点的世界坐标， 不能直接传出顶点到光源的距离，会出现插值错误
layout (location = 0) out vec3 OutWorldPos;


void main()
{
  vec4 WorldPos =  Model.Model * vec4(InPos, 1.0);

  gl_Position = PointLight.ProjectView *WorldPos;
  
  OutWorldPos= WorldPos.xyz;
}